#include "SubGoal.h"

SubGoal::SubGoal(){

}

SubGoal::~SubGoal(){

}

void SubGoal::setHead(Predicate h){
	head.predicateName=h.predicateName;
	head.argument1=h.argument1;
	head.argument2=h.argument2;
	head.argument3=h.argument3;
	head.arguments=h.arguments;
}

void SubGoal::setTail(std::list<Predicate> t){
	tail = t;
}

Predicate SubGoal::getHead(){
	return head;
}

std::list<Predicate> SubGoal::getTail(){
	return tail;
}

std::string SubGoal::toString(){
//	return "<" + head.toString() + ", " + tail.toString() + ">";
	std::string info;
	info.append("<");
	info.append(head.toString());
	info.append(", ");
	std::list<Predicate>::iterator g_i_begin=tail.begin();
	std::list<Predicate>::iterator g_i_end = tail.end();
	info +="[";
	for(std::list<Predicate>::iterator g_i_i=g_i_begin;g_i_i!=g_i_end;g_i_i++){
		info += g_i_i->toString();
	}
	info +="]";
	info +=(">\n");
	return info;
}
